package org.record.mood.web.controller;

import org.record.mood.bean.About;
import org.record.mood.bean.Nav;
import org.record.mood.service.NavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @description:
 * @author: sunyw
 * @time: 2020-04-16 9:37
 */
@Controller
@RequestMapping("/record")
public class IndexController {

    @Autowired
    private NavService navService;

    /**
     * 首页数据查询
     *
     * @param model
     * @return
     */
    @GetMapping("/index")
    public String index(Model model) {
        List<Nav> navList = navService.indexNav();
        model.addAttribute("navList", navList);
        return "index";
    }

    /**
     * 关于
     *
     * @param model
     * @return
     */
    @GetMapping("/aboutme")
    public String about(Model model) {
        About about = navService.about();
        model.addAttribute("about", about);
        return "others/about";
    }
}
